package com.guigu.controller;

import com.guigu.domain.Department;
import com.guigu.domain.Msg;
import com.guigu.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/department")
public class DepartmentController {
    @Autowired
    private DepartmentService departmentService;

    @RequestMapping("/getAllDept")
    @ResponseBody
    public Msg getAllDeptWithJson(){
        List<Department> allDept = departmentService.getAllDept ();

        return Msg.success ().add ("allDept",allDept);
    }
}
